# Delete File
Deletes files from SharePoint by processing rows from an Excel file.
Filename pattern: filename must contain deletefile or removefile (case-insensitive). Files whose names contain doclibdeletefileversion are excluded.
Example: 20240115 deletefile cleanup.xlsx
# Columns
| Name | Required | Description |
|---|---|---|
| MatterCode | Conditional | Matter identifier. Required when SiteUrl is not provided. |
| ClientCode | No | Client identifier used together with MatterCode to resolve the matter. |
| SiteUrl | Conditional | Direct URL of the SharePoint site. Required when MatterCode is not provided. |
| Url / File / Doc / Document | No | URL of the specific file to delete. |
| Force / UndoCheckout | No | Boolean. When true, undoes the checkout before deleting if the file is checked out. Defaults to false. |
| Modified / LastModified | No | Only delete the file if it was last modified before this date. |
| RecycleBin / Recycle | No | Boolean. When true, sends the file to the recycle bin instead of permanently deleting it. Defaults to false. |
Either MatterCode or SiteUrl must be provided.
# Behavior
Either MatterCode or SiteUrl must be provided. If both are empty and Url is provided, the handler attempts to derive a site URL from the Url value by stripping the last path segment. If all three are empty, the row fails.
RecycleBin defaults to false — files are permanently deleted unless RecycleBin is explicitly set to true.
# Related links
- Move File handler — move files to an archive location instead of deleting
- Doclib Set handler — manage document library structure